openapi: 3.0.1
info:
  title: CR - Council to ePlanning API
  description: Certification Management API for Council.
  version: v1
servers:
  - url: https://api-uat.apps1.nsw.gov.au/planning/CRMgmt/Councils/v1
paths:
  /Decline/{CaseID}:
    put:
      summary: Decline
      description: >-
        This operation transfers the council's decision to decline the
        Certificate Registration application from the council's IT system to the
        Online Certificate Registration Service.
      operationId: Decline
      parameters:
        - name: CaseID
          in: path
          description: A fully qualified application number or case id
          required: true
          schema:
            type: string
        - name: OrganisationID
          in: header
          description: >-
            The council LGA name to indicate the request is originating from a
            specific council
          required: true
          schema:
            type: string
      requestBody:
        description: body
        content:
          '*/*':
            schema:
              $ref: '#/components/schemas/Decline'
        required: true
      responses:
        '200':
          description: Case Declined
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/DeclineResponse'
        '400':
          description: Invalid request supplied
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Case not found or locked by another user
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Error'
      x-codegen-request-body-name: body
  /Register/{CaseID}:
    put:
      summary: Register
      description: >-
        This operation transfers the council's decision to accept the
        Certificate Registration from the council's IT system to the Online
        Certificate Registration Service.
      operationId: Registration
      parameters:
        - name: CaseID
          in: path
          description: A fully qualified application number or case id
          required: true
          schema:
            type: string
        - name: OrganisationID
          in: header
          description: >-
            The council LGA name to indicate where the request is originated
            from
          required: true
          schema:
            type: string
      requestBody:
        description: body
        content:
          '*/*':
            schema:
              $ref: '#/components/schemas/Register'
        required: true
      responses:
        '200':
          description: Certificate registered sucessfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Response'
        '400':
          description: Invalid request supplied
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Case not found or locked by another user
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-codegen-request-body-name: body
components:
  schemas:
    Decline:
      required:
        - declineReasons
        - updatedByEmail
      type: object
      properties:
        declineReasons:
          type: array
          items:
            $ref: '#/components/schemas/declineReasonList'
        declineReasonDescription:
          maxLength: 512
          type: string
          description: required only if 'OTHER' is selected for declineReason
        updatedByEmail:
          maxLength: 250
          type: string
          description: User must be registered in the planning portal
          example: john.smith@gmail.com
    declineReasonList:
      required:
        - declineReason
      type: object
      properties:
        declineReason:
          type: string
          description: >-
            One of the below mentioned values must be selected for declineReason
            1. InComplete 2. Poor Quality 3. In-sufficient Documentation
            submitted 4. Payment Not Received 5. Other
          example: Refer to description for values
    Register:
      required:
        - Declaration
        - ReferenceNumber
        - RegistrationDate
        - updatedByEmail
      type: object
      properties:
        ReferenceNumber:
          type: string
          description: Council system Reference Number
        Comments:
          type: string
          description: Additional comments
        RegistrationDate:
          type: string
          description: Council system Registration date
          format: date
        Declaration:
          type: boolean
          description: >-
            gives consent that certificate details are correct, payment has been
            received, relevant checks are done and the certificate has been
            registered in Council's certificate registration system.
        Documents:
          type: array
          items:
            $ref: '#/components/schemas/DownloadableDocument'
        updatedByEmail:
          maxLength: 250
          type: string
          description: User must be registered in the planning portal
          example: john.smith@gmail.com
    DocResponse:
      title: DocResponse
      type: object
      properties:
        documentName:
          type: string
          description: documentName which was uploaded as part of respective API opeartion
          example: test.docx
        documentType:
          type: string
          description: Type of Document under which repsective document was uploaded
        eplanningDocId:
          type: string
          description: DocId of the respective document which was uploaded
        externalOrgDocURL:
          type: string
          description: URL of the document which was uploaded
    DeclineResponse:
      type: object
      properties:
        statusCode:
          type: integer
          example: 200
        message:
          type: string
        activityId:
          type: string
        caseID:
          type: string
          description: Visible when case id is created during the process.
    Response:
      type: object
      properties:
        statusCode:
          type: integer
          example: 200
        message:
          type: string
        activityId:
          type: string
        caseID:
          type: string
          description: Visible when case id is created during the process.
        Documents:
          type: array
          description: Attached documents with eplanningDocIds.
          items:
            $ref: '#/components/schemas/DocResponse'
    Person:
      type: object
      properties:
        person:
          $ref: '#/components/schemas/PersonBody'
    PersonBody:
      required:
        - contactNumber
        - emailAddress
        - firstName
        - surname
      type: object
      properties:
        firstName:
          maxLength: 20
          type: string
          example: John
        surname:
          maxLength: 20
          type: string
          example: Smith
        emailAddress:
          maxLength: 250
          type: string
          description: User must be registered in the planning portal
          example: john.smith@gmail.com
        contactNumber:
          maxLength: 10
          minLength: 8
          pattern: ^[0-9]+$
          type: string
    DownloadableDocument:
      required:
        - documentName
        - documentType
        - documentURL
        - uploadedDateTime
      type: object
      properties:
        documentName:
          maxLength: 150
          type: string
        documentType:
          maxLength: 100
          type: string
        uploadedDateTime:
          type: string
          format: date-time
        documentURL:
          maxLength: 500
          type: string
          description: URL of the document to be downloaded
          format: uri
    Error:
      type: object
      properties:
        ErrorResponse:
          type: object
          properties:
            DPE_ERROR_CODE:
              type: string
              example: DPE_E100
            DPE_ERROR_DESCRIPTION:
              type: string
  securitySchemes:
    api_key:
      type: apiKey
      name: api-key
      in: header
